/* 自定义样式 */

/* 全局样式 */
body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #388E3C;
}

/* 自定义动画效果 */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* 图片占位符样式 */
.img-placeholder {
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

/* 食品分析页面特定样式 */
.upload-area {
    border: 2px dashed #4CAF50;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #2E7D32;
    background-color: rgba(76, 175, 80, 0.05);
}

.upload-area.active {
    border-color: #2E7D32;
    background-color: rgba(76, 175, 80, 0.1);
}

/* 健康档案表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #4b5563;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out;
}

.form-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* 营养成分显示样式 */
.nutrition-card {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.nutrition-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.nutrition-header {
    background-color: #4CAF50;
    color: white;
    padding: 1rem;
}

.nutrition-body {
    padding: 1.5rem;
}

.nutrition-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.nutrition-item:last-child {
    border-bottom: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .nutrition-card {
        margin-bottom: 1.5rem;
    }
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.loading-spinner:after {
    content: " ";
    display: block;
    border-radius: 50%;
    width: 0;
    height: 0;
    margin: 8px;
    box-sizing: border-box;
    border: 32px solid #4CAF50;
    border-color: #4CAF50 transparent #4CAF50 transparent;
    animation: loading-spinner 1.2s infinite;
}

@keyframes loading-spinner {
    0% {
        transform: rotate(0);
        animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
    }
    50% {
        transform: rotate(180deg);
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 加载文字动画 */
.loading-text:after {
    content: '...';
    animation: loading-text 1.5s infinite;
    display: inline-block;
    width: 24px;
    text-align: left;
}

@keyframes loading-text {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
    100% { content: '.'; }
}

/* 提示消息样式 */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background-color: #4CAF50;
}

.toast-error {
    background-color: #F44336;
}

.toast-info {
    background-color: #2196F3;
}